<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Caffe: caffe::SoftmaxWithLossLayer&lt; Dtype &gt; Class Template Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Caffe
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespacecaffe.html">caffe</a></li><li class="navelem"><a class="el" href="classcaffe_1_1SoftmaxWithLossLayer.html">SoftmaxWithLossLayer</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pro-methods">Protected Member Functions</a> &#124;
<a href="#pro-attribs">Protected Attributes</a> &#124;
<a href="classcaffe_1_1SoftmaxWithLossLayer-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">caffe::SoftmaxWithLossLayer&lt; Dtype &gt; Class Template Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Computes the multinomial logistic loss for a one-of-many classification task, passing real-valued predictions through a softmax to get a probability distribution over classes.  
 <a href="classcaffe_1_1SoftmaxWithLossLayer.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="softmax__loss__layer_8hpp_source.html">softmax_loss_layer.hpp</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for caffe::SoftmaxWithLossLayer&lt; Dtype &gt;:</div>
<div class="dyncontent">
 <div class="center">
  <img src="classcaffe_1_1SoftmaxWithLossLayer.png" usemap="#caffe::SoftmaxWithLossLayer_3C_20Dtype_20_3E_map" alt=""/>
  <map id="caffe::SoftmaxWithLossLayer_3C_20Dtype_20_3E_map" name="caffe::SoftmaxWithLossLayer_3C_20Dtype_20_3E_map">
<area href="classcaffe_1_1LossLayer.html" title="An interface for Layers that take two Blobs as input – usually (1) predictions and (2) ground-truth ..." alt="caffe::LossLayer&lt; Dtype &gt;" shape="rect" coords="0,56,231,80"/>
<area href="classcaffe_1_1Layer.html" title="An interface for the units of computation which can be composed into a Net. " alt="caffe::Layer&lt; Dtype &gt;" shape="rect" coords="0,0,231,24"/>
</map>
 </div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:ac3a01d6846a9b62c1790635d53185e81"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1SoftmaxWithLossLayer.html#ac3a01d6846a9b62c1790635d53185e81">SoftmaxWithLossLayer</a> (const LayerParameter &amp;param)</td></tr>
<tr class="separator:ac3a01d6846a9b62c1790635d53185e81"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a96cd04896d4b805fcaf36c2c6522ae10"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1SoftmaxWithLossLayer.html#a96cd04896d4b805fcaf36c2c6522ae10">LayerSetUp</a> (const vector&lt; <a class="el" href="classcaffe_1_1Blob.html">Blob</a>&lt; Dtype &gt; *&gt; &amp;bottom, const vector&lt; <a class="el" href="classcaffe_1_1Blob.html">Blob</a>&lt; Dtype &gt; *&gt; &amp;top)</td></tr>
<tr class="memdesc:a96cd04896d4b805fcaf36c2c6522ae10"><td class="mdescLeft">&#160;</td><td class="mdescRight">Does layer-specific setup: your layer should implement this function as well as Reshape.  <a href="#a96cd04896d4b805fcaf36c2c6522ae10">More...</a><br /></td></tr>
<tr class="separator:a96cd04896d4b805fcaf36c2c6522ae10"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2821b89b0f46a5e2ddaccb2708ab237b"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1SoftmaxWithLossLayer.html#a2821b89b0f46a5e2ddaccb2708ab237b">Reshape</a> (const vector&lt; <a class="el" href="classcaffe_1_1Blob.html">Blob</a>&lt; Dtype &gt; *&gt; &amp;bottom, const vector&lt; <a class="el" href="classcaffe_1_1Blob.html">Blob</a>&lt; Dtype &gt; *&gt; &amp;top)</td></tr>
<tr class="memdesc:a2821b89b0f46a5e2ddaccb2708ab237b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Adjust the shapes of top blobs and internal buffers to accommodate the shapes of the bottom blobs.  <a href="#a2821b89b0f46a5e2ddaccb2708ab237b">More...</a><br /></td></tr>
<tr class="separator:a2821b89b0f46a5e2ddaccb2708ab237b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a79aad991f6c56097068ccca031f1288a"><td class="memItemLeft" align="right" valign="top"><a id="a79aad991f6c56097068ccca031f1288a"></a>
virtual const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1SoftmaxWithLossLayer.html#a79aad991f6c56097068ccca031f1288a">type</a> () const</td></tr>
<tr class="memdesc:a79aad991f6c56097068ccca031f1288a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the layer type. <br /></td></tr>
<tr class="separator:a79aad991f6c56097068ccca031f1288a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9035d000b2ce51a973f255a5eb2df8e3"><td class="memItemLeft" align="right" valign="top">virtual int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1SoftmaxWithLossLayer.html#a9035d000b2ce51a973f255a5eb2df8e3">ExactNumTopBlobs</a> () const</td></tr>
<tr class="memdesc:a9035d000b2ce51a973f255a5eb2df8e3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the exact number of top blobs required by the layer, or -1 if no exact number is required.  <a href="#a9035d000b2ce51a973f255a5eb2df8e3">More...</a><br /></td></tr>
<tr class="separator:a9035d000b2ce51a973f255a5eb2df8e3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9969336702fb1bbf31750629fb38fb45"><td class="memItemLeft" align="right" valign="top">virtual int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1SoftmaxWithLossLayer.html#a9969336702fb1bbf31750629fb38fb45">MinTopBlobs</a> () const</td></tr>
<tr class="memdesc:a9969336702fb1bbf31750629fb38fb45"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the minimum number of top blobs required by the layer, or -1 if no minimum number is required.  <a href="#a9969336702fb1bbf31750629fb38fb45">More...</a><br /></td></tr>
<tr class="separator:a9969336702fb1bbf31750629fb38fb45"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5a0b4c02fe76ae9087cd8b1b9edd9910"><td class="memItemLeft" align="right" valign="top">virtual int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1SoftmaxWithLossLayer.html#a5a0b4c02fe76ae9087cd8b1b9edd9910">MaxTopBlobs</a> () const</td></tr>
<tr class="memdesc:a5a0b4c02fe76ae9087cd8b1b9edd9910"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the maximum number of top blobs required by the layer, or -1 if no maximum number is required.  <a href="#a5a0b4c02fe76ae9087cd8b1b9edd9910">More...</a><br /></td></tr>
<tr class="separator:a5a0b4c02fe76ae9087cd8b1b9edd9910"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="inherit_header pub_methods_classcaffe_1_1LossLayer"><td colspan="2" onclick="javascript:toggleInherit('pub_methods_classcaffe_1_1LossLayer')"><img src="closed.png" alt="-"/>&#160;Public Member Functions inherited from <a class="el" href="classcaffe_1_1LossLayer.html">caffe::LossLayer&lt; Dtype &gt;</a></td></tr>
<tr class="memitem:a16e133050e2d97c6f024ea74e3ba4ead inherit pub_methods_classcaffe_1_1LossLayer"><td class="memItemLeft" align="right" valign="top"><a id="a16e133050e2d97c6f024ea74e3ba4ead"></a>
&#160;</td><td class="memItemRight" valign="bottom"><b>LossLayer</b> (const LayerParameter &amp;param)</td></tr>
<tr class="separator:a16e133050e2d97c6f024ea74e3ba4ead inherit pub_methods_classcaffe_1_1LossLayer"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af1620064baefb711e2c767bdc92b6fb1 inherit pub_methods_classcaffe_1_1LossLayer"><td class="memItemLeft" align="right" valign="top">virtual int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1LossLayer.html#af1620064baefb711e2c767bdc92b6fb1">ExactNumBottomBlobs</a> () const</td></tr>
<tr class="memdesc:af1620064baefb711e2c767bdc92b6fb1 inherit pub_methods_classcaffe_1_1LossLayer"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the exact number of bottom blobs required by the layer, or -1 if no exact number is required.  <a href="classcaffe_1_1LossLayer.html#af1620064baefb711e2c767bdc92b6fb1">More...</a><br /></td></tr>
<tr class="separator:af1620064baefb711e2c767bdc92b6fb1 inherit pub_methods_classcaffe_1_1LossLayer"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae98a9942cdb1c67e09d45cc2d876618e inherit pub_methods_classcaffe_1_1LossLayer"><td class="memItemLeft" align="right" valign="top"><a id="ae98a9942cdb1c67e09d45cc2d876618e"></a>
virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1LossLayer.html#ae98a9942cdb1c67e09d45cc2d876618e">AutoTopBlobs</a> () const</td></tr>
<tr class="memdesc:ae98a9942cdb1c67e09d45cc2d876618e inherit pub_methods_classcaffe_1_1LossLayer"><td class="mdescLeft">&#160;</td><td class="mdescRight">For convenience and backwards compatibility, instruct the <a class="el" href="classcaffe_1_1Net.html" title="Connects Layers together into a directed acyclic graph (DAG) specified by a NetParameter. ">Net</a> to automatically allocate a single top <a class="el" href="classcaffe_1_1Blob.html" title="A wrapper around SyncedMemory holders serving as the basic computational unit through which Layers...">Blob</a> for LossLayers, into which they output their singleton loss, (even if the user didn't specify one in the prototxt, etc.). <br /></td></tr>
<tr class="separator:ae98a9942cdb1c67e09d45cc2d876618e inherit pub_methods_classcaffe_1_1LossLayer"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a36d35155bfe0de53a79c517f33759612 inherit pub_methods_classcaffe_1_1LossLayer"><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1LossLayer.html#a36d35155bfe0de53a79c517f33759612">AllowForceBackward</a> (const int bottom_index) const</td></tr>
<tr class="separator:a36d35155bfe0de53a79c517f33759612 inherit pub_methods_classcaffe_1_1LossLayer"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="inherit_header pub_methods_classcaffe_1_1Layer"><td colspan="2" onclick="javascript:toggleInherit('pub_methods_classcaffe_1_1Layer')"><img src="closed.png" alt="-"/>&#160;Public Member Functions inherited from <a class="el" href="classcaffe_1_1Layer.html">caffe::Layer&lt; Dtype &gt;</a></td></tr>
<tr class="memitem:a7b4e4ccea08c7b8b15acc6829d5735f6 inherit pub_methods_classcaffe_1_1Layer"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1Layer.html#a7b4e4ccea08c7b8b15acc6829d5735f6">Layer</a> (const LayerParameter &amp;param)</td></tr>
<tr class="separator:a7b4e4ccea08c7b8b15acc6829d5735f6 inherit pub_methods_classcaffe_1_1Layer"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a18d6bfdb535ab8e96a971dec4ae39a84 inherit pub_methods_classcaffe_1_1Layer"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1Layer.html#a18d6bfdb535ab8e96a971dec4ae39a84">SetUp</a> (const vector&lt; <a class="el" href="classcaffe_1_1Blob.html">Blob</a>&lt; Dtype &gt; *&gt; &amp;bottom, const vector&lt; <a class="el" href="classcaffe_1_1Blob.html">Blob</a>&lt; Dtype &gt; *&gt; &amp;top)</td></tr>
<tr class="memdesc:a18d6bfdb535ab8e96a971dec4ae39a84 inherit pub_methods_classcaffe_1_1Layer"><td class="mdescLeft">&#160;</td><td class="mdescRight">Implements common layer setup functionality.  <a href="classcaffe_1_1Layer.html#a18d6bfdb535ab8e96a971dec4ae39a84">More...</a><br /></td></tr>
<tr class="separator:a18d6bfdb535ab8e96a971dec4ae39a84 inherit pub_methods_classcaffe_1_1Layer"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab57d272dabe8c709d2a785eebe72ca57 inherit pub_methods_classcaffe_1_1Layer"><td class="memItemLeft" align="right" valign="top">Dtype&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1Layer.html#ab57d272dabe8c709d2a785eebe72ca57">Forward</a> (const vector&lt; <a class="el" href="classcaffe_1_1Blob.html">Blob</a>&lt; Dtype &gt; *&gt; &amp;bottom, const vector&lt; <a class="el" href="classcaffe_1_1Blob.html">Blob</a>&lt; Dtype &gt; *&gt; &amp;top)</td></tr>
<tr class="memdesc:ab57d272dabe8c709d2a785eebe72ca57 inherit pub_methods_classcaffe_1_1Layer"><td class="mdescLeft">&#160;</td><td class="mdescRight">Given the bottom blobs, compute the top blobs and the loss.  <a href="classcaffe_1_1Layer.html#ab57d272dabe8c709d2a785eebe72ca57">More...</a><br /></td></tr>
<tr class="separator:ab57d272dabe8c709d2a785eebe72ca57 inherit pub_methods_classcaffe_1_1Layer"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a183d343f5183a4762307f2c5e6ed1e12 inherit pub_methods_classcaffe_1_1Layer"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1Layer.html#a183d343f5183a4762307f2c5e6ed1e12">Backward</a> (const vector&lt; <a class="el" href="classcaffe_1_1Blob.html">Blob</a>&lt; Dtype &gt; *&gt; &amp;top, const vector&lt; bool &gt; &amp;propagate_down, const vector&lt; <a class="el" href="classcaffe_1_1Blob.html">Blob</a>&lt; Dtype &gt; *&gt; &amp;bottom)</td></tr>
<tr class="memdesc:a183d343f5183a4762307f2c5e6ed1e12 inherit pub_methods_classcaffe_1_1Layer"><td class="mdescLeft">&#160;</td><td class="mdescRight">Given the top blob error gradients, compute the bottom blob error gradients.  <a href="classcaffe_1_1Layer.html#a183d343f5183a4762307f2c5e6ed1e12">More...</a><br /></td></tr>
<tr class="separator:a183d343f5183a4762307f2c5e6ed1e12 inherit pub_methods_classcaffe_1_1Layer"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aaf4524ce8641a30a8a4784aee1b2b4c8 inherit pub_methods_classcaffe_1_1Layer"><td class="memItemLeft" align="right" valign="top"><a id="aaf4524ce8641a30a8a4784aee1b2b4c8"></a>
vector&lt; shared_ptr&lt; <a class="el" href="classcaffe_1_1Blob.html">Blob</a>&lt; Dtype &gt; &gt; &gt; &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1Layer.html#aaf4524ce8641a30a8a4784aee1b2b4c8">blobs</a> ()</td></tr>
<tr class="memdesc:aaf4524ce8641a30a8a4784aee1b2b4c8 inherit pub_methods_classcaffe_1_1Layer"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the vector of learnable parameter blobs. <br /></td></tr>
<tr class="separator:aaf4524ce8641a30a8a4784aee1b2b4c8 inherit pub_methods_classcaffe_1_1Layer"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:adff82274f146e2b6922d0ebac2aaf215 inherit pub_methods_classcaffe_1_1Layer"><td class="memItemLeft" align="right" valign="top"><a id="adff82274f146e2b6922d0ebac2aaf215"></a>
const LayerParameter &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1Layer.html#adff82274f146e2b6922d0ebac2aaf215">layer_param</a> () const</td></tr>
<tr class="memdesc:adff82274f146e2b6922d0ebac2aaf215 inherit pub_methods_classcaffe_1_1Layer"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the layer parameter. <br /></td></tr>
<tr class="separator:adff82274f146e2b6922d0ebac2aaf215 inherit pub_methods_classcaffe_1_1Layer"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4a1754828dda22cc8daa2f63377f3579 inherit pub_methods_classcaffe_1_1Layer"><td class="memItemLeft" align="right" valign="top"><a id="a4a1754828dda22cc8daa2f63377f3579"></a>
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1Layer.html#a4a1754828dda22cc8daa2f63377f3579">ToProto</a> (LayerParameter *param, bool write_diff=false)</td></tr>
<tr class="memdesc:a4a1754828dda22cc8daa2f63377f3579 inherit pub_methods_classcaffe_1_1Layer"><td class="mdescLeft">&#160;</td><td class="mdescRight">Writes the layer parameter to a protocol buffer. <br /></td></tr>
<tr class="separator:a4a1754828dda22cc8daa2f63377f3579 inherit pub_methods_classcaffe_1_1Layer"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a899410336f30821644c8bd6c69a070c9 inherit pub_methods_classcaffe_1_1Layer"><td class="memItemLeft" align="right" valign="top"><a id="a899410336f30821644c8bd6c69a070c9"></a>
Dtype&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1Layer.html#a899410336f30821644c8bd6c69a070c9">loss</a> (const int top_index) const</td></tr>
<tr class="memdesc:a899410336f30821644c8bd6c69a070c9 inherit pub_methods_classcaffe_1_1Layer"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the scalar loss associated with a top blob at a given index. <br /></td></tr>
<tr class="separator:a899410336f30821644c8bd6c69a070c9 inherit pub_methods_classcaffe_1_1Layer"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a899b09f4b91ada8545b3a43ee91e0d69 inherit pub_methods_classcaffe_1_1Layer"><td class="memItemLeft" align="right" valign="top"><a id="a899b09f4b91ada8545b3a43ee91e0d69"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1Layer.html#a899b09f4b91ada8545b3a43ee91e0d69">set_loss</a> (const int top_index, const Dtype value)</td></tr>
<tr class="memdesc:a899b09f4b91ada8545b3a43ee91e0d69 inherit pub_methods_classcaffe_1_1Layer"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the loss associated with a top blob at a given index. <br /></td></tr>
<tr class="separator:a899b09f4b91ada8545b3a43ee91e0d69 inherit pub_methods_classcaffe_1_1Layer"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aca3cb2bafaefda5d4760aaebd0b72def inherit pub_methods_classcaffe_1_1Layer"><td class="memItemLeft" align="right" valign="top">virtual int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1Layer.html#aca3cb2bafaefda5d4760aaebd0b72def">MinBottomBlobs</a> () const</td></tr>
<tr class="memdesc:aca3cb2bafaefda5d4760aaebd0b72def inherit pub_methods_classcaffe_1_1Layer"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the minimum number of bottom blobs required by the layer, or -1 if no minimum number is required.  <a href="classcaffe_1_1Layer.html#aca3cb2bafaefda5d4760aaebd0b72def">More...</a><br /></td></tr>
<tr class="separator:aca3cb2bafaefda5d4760aaebd0b72def inherit pub_methods_classcaffe_1_1Layer"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af8bdc989053e0363ab032026b46de7c3 inherit pub_methods_classcaffe_1_1Layer"><td class="memItemLeft" align="right" valign="top">virtual int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1Layer.html#af8bdc989053e0363ab032026b46de7c3">MaxBottomBlobs</a> () const</td></tr>
<tr class="memdesc:af8bdc989053e0363ab032026b46de7c3 inherit pub_methods_classcaffe_1_1Layer"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the maximum number of bottom blobs required by the layer, or -1 if no maximum number is required.  <a href="classcaffe_1_1Layer.html#af8bdc989053e0363ab032026b46de7c3">More...</a><br /></td></tr>
<tr class="separator:af8bdc989053e0363ab032026b46de7c3 inherit pub_methods_classcaffe_1_1Layer"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af452a938bc7596f9b5e9900c8dc4ab3d inherit pub_methods_classcaffe_1_1Layer"><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1Layer.html#af452a938bc7596f9b5e9900c8dc4ab3d">EqualNumBottomTopBlobs</a> () const</td></tr>
<tr class="memdesc:af452a938bc7596f9b5e9900c8dc4ab3d inherit pub_methods_classcaffe_1_1Layer"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns true if the layer requires an equal number of bottom and top blobs.  <a href="classcaffe_1_1Layer.html#af452a938bc7596f9b5e9900c8dc4ab3d">More...</a><br /></td></tr>
<tr class="separator:af452a938bc7596f9b5e9900c8dc4ab3d inherit pub_methods_classcaffe_1_1Layer"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1a3708013b0231e71d725252e10ce6e3 inherit pub_methods_classcaffe_1_1Layer"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1Layer.html#a1a3708013b0231e71d725252e10ce6e3">param_propagate_down</a> (const int param_id)</td></tr>
<tr class="memdesc:a1a3708013b0231e71d725252e10ce6e3 inherit pub_methods_classcaffe_1_1Layer"><td class="mdescLeft">&#160;</td><td class="mdescRight">Specifies whether the layer should compute gradients w.r.t. a parameter at a particular index given by param_id.  <a href="classcaffe_1_1Layer.html#a1a3708013b0231e71d725252e10ce6e3">More...</a><br /></td></tr>
<tr class="separator:a1a3708013b0231e71d725252e10ce6e3 inherit pub_methods_classcaffe_1_1Layer"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9a6fcb843803ed556f0a69cc2864379b inherit pub_methods_classcaffe_1_1Layer"><td class="memItemLeft" align="right" valign="top"><a id="a9a6fcb843803ed556f0a69cc2864379b"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1Layer.html#a9a6fcb843803ed556f0a69cc2864379b">set_param_propagate_down</a> (const int param_id, const bool value)</td></tr>
<tr class="memdesc:a9a6fcb843803ed556f0a69cc2864379b inherit pub_methods_classcaffe_1_1Layer"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets whether the layer should compute gradients w.r.t. a parameter at a particular index given by param_id. <br /></td></tr>
<tr class="separator:a9a6fcb843803ed556f0a69cc2864379b inherit pub_methods_classcaffe_1_1Layer"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-methods"></a>
Protected Member Functions</h2></td></tr>
<tr class="memitem:a093493e6f87ee7a411e4c468b5fa9f9c"><td class="memItemLeft" align="right" valign="top"><a id="a093493e6f87ee7a411e4c468b5fa9f9c"></a>
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1SoftmaxWithLossLayer.html#a093493e6f87ee7a411e4c468b5fa9f9c">Forward_cpu</a> (const vector&lt; <a class="el" href="classcaffe_1_1Blob.html">Blob</a>&lt; Dtype &gt; *&gt; &amp;bottom, const vector&lt; <a class="el" href="classcaffe_1_1Blob.html">Blob</a>&lt; Dtype &gt; *&gt; &amp;top)</td></tr>
<tr class="memdesc:a093493e6f87ee7a411e4c468b5fa9f9c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Using the CPU device, compute the layer output. <br /></td></tr>
<tr class="separator:a093493e6f87ee7a411e4c468b5fa9f9c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a558fbaaf863070caac03c7566aefdf11"><td class="memItemLeft" align="right" valign="top"><a id="a558fbaaf863070caac03c7566aefdf11"></a>
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1SoftmaxWithLossLayer.html#a558fbaaf863070caac03c7566aefdf11">Forward_gpu</a> (const vector&lt; <a class="el" href="classcaffe_1_1Blob.html">Blob</a>&lt; Dtype &gt; *&gt; &amp;bottom, const vector&lt; <a class="el" href="classcaffe_1_1Blob.html">Blob</a>&lt; Dtype &gt; *&gt; &amp;top)</td></tr>
<tr class="memdesc:a558fbaaf863070caac03c7566aefdf11"><td class="mdescLeft">&#160;</td><td class="mdescRight">Using the GPU device, compute the layer output. Fall back to <a class="el" href="classcaffe_1_1SoftmaxWithLossLayer.html#a093493e6f87ee7a411e4c468b5fa9f9c" title="Using the CPU device, compute the layer output. ">Forward_cpu()</a> if unavailable. <br /></td></tr>
<tr class="separator:a558fbaaf863070caac03c7566aefdf11"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a39d8b7d59f2c951ac2573827f181284f"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1SoftmaxWithLossLayer.html#a39d8b7d59f2c951ac2573827f181284f">Backward_cpu</a> (const vector&lt; <a class="el" href="classcaffe_1_1Blob.html">Blob</a>&lt; Dtype &gt; *&gt; &amp;top, const vector&lt; bool &gt; &amp;propagate_down, const vector&lt; <a class="el" href="classcaffe_1_1Blob.html">Blob</a>&lt; Dtype &gt; *&gt; &amp;bottom)</td></tr>
<tr class="memdesc:a39d8b7d59f2c951ac2573827f181284f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Computes the softmax loss error gradient w.r.t. the predictions.  <a href="#a39d8b7d59f2c951ac2573827f181284f">More...</a><br /></td></tr>
<tr class="separator:a39d8b7d59f2c951ac2573827f181284f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac6ae6482673cab4933ceb67972f80ee7"><td class="memItemLeft" align="right" valign="top"><a id="ac6ae6482673cab4933ceb67972f80ee7"></a>
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1SoftmaxWithLossLayer.html#ac6ae6482673cab4933ceb67972f80ee7">Backward_gpu</a> (const vector&lt; <a class="el" href="classcaffe_1_1Blob.html">Blob</a>&lt; Dtype &gt; *&gt; &amp;top, const vector&lt; bool &gt; &amp;propagate_down, const vector&lt; <a class="el" href="classcaffe_1_1Blob.html">Blob</a>&lt; Dtype &gt; *&gt; &amp;bottom)</td></tr>
<tr class="memdesc:ac6ae6482673cab4933ceb67972f80ee7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Using the GPU device, compute the gradients for any parameters and for the bottom blobs if propagate_down is true. Fall back to <a class="el" href="classcaffe_1_1SoftmaxWithLossLayer.html#a39d8b7d59f2c951ac2573827f181284f" title="Computes the softmax loss error gradient w.r.t. the predictions. ">Backward_cpu()</a> if unavailable. <br /></td></tr>
<tr class="separator:ac6ae6482673cab4933ceb67972f80ee7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aef4567bafcd7b1665f2a2cc71ea02ff4"><td class="memItemLeft" align="right" valign="top">virtual Dtype&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1SoftmaxWithLossLayer.html#aef4567bafcd7b1665f2a2cc71ea02ff4">get_normalizer</a> (LossParameter_NormalizationMode normalization_mode, int valid_count)</td></tr>
<tr class="separator:aef4567bafcd7b1665f2a2cc71ea02ff4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="inherit_header pro_methods_classcaffe_1_1Layer"><td colspan="2" onclick="javascript:toggleInherit('pro_methods_classcaffe_1_1Layer')"><img src="closed.png" alt="-"/>&#160;Protected Member Functions inherited from <a class="el" href="classcaffe_1_1Layer.html">caffe::Layer&lt; Dtype &gt;</a></td></tr>
<tr class="memitem:a55c8036130225fbc874a986bdf4b27e2 inherit pro_methods_classcaffe_1_1Layer"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1Layer.html#a55c8036130225fbc874a986bdf4b27e2">CheckBlobCounts</a> (const vector&lt; <a class="el" href="classcaffe_1_1Blob.html">Blob</a>&lt; Dtype &gt; *&gt; &amp;bottom, const vector&lt; <a class="el" href="classcaffe_1_1Blob.html">Blob</a>&lt; Dtype &gt; *&gt; &amp;top)</td></tr>
<tr class="separator:a55c8036130225fbc874a986bdf4b27e2 inherit pro_methods_classcaffe_1_1Layer"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a04eb2a3d1d59c64cd64c233217d5d6fc inherit pro_methods_classcaffe_1_1Layer"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1Layer.html#a04eb2a3d1d59c64cd64c233217d5d6fc">SetLossWeights</a> (const vector&lt; <a class="el" href="classcaffe_1_1Blob.html">Blob</a>&lt; Dtype &gt; *&gt; &amp;top)</td></tr>
<tr class="separator:a04eb2a3d1d59c64cd64c233217d5d6fc inherit pro_methods_classcaffe_1_1Layer"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-attribs"></a>
Protected Attributes</h2></td></tr>
<tr class="memitem:a886b9e8c044917b03e7d2d04e713a05b"><td class="memItemLeft" align="right" valign="top"><a id="a886b9e8c044917b03e7d2d04e713a05b"></a>
shared_ptr&lt; <a class="el" href="classcaffe_1_1Layer.html">Layer</a>&lt; Dtype &gt; &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1SoftmaxWithLossLayer.html#a886b9e8c044917b03e7d2d04e713a05b">softmax_layer_</a></td></tr>
<tr class="memdesc:a886b9e8c044917b03e7d2d04e713a05b"><td class="mdescLeft">&#160;</td><td class="mdescRight">The internal <a class="el" href="classcaffe_1_1SoftmaxLayer.html" title="Computes the softmax function. ">SoftmaxLayer</a> used to map predictions to a distribution. <br /></td></tr>
<tr class="separator:a886b9e8c044917b03e7d2d04e713a05b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a02669f20097006452d877ea05e98b775"><td class="memItemLeft" align="right" valign="top"><a id="a02669f20097006452d877ea05e98b775"></a>
<a class="el" href="classcaffe_1_1Blob.html">Blob</a>&lt; Dtype &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1SoftmaxWithLossLayer.html#a02669f20097006452d877ea05e98b775">prob_</a></td></tr>
<tr class="memdesc:a02669f20097006452d877ea05e98b775"><td class="mdescLeft">&#160;</td><td class="mdescRight">prob stores the output probability predictions from the <a class="el" href="classcaffe_1_1SoftmaxLayer.html" title="Computes the softmax function. ">SoftmaxLayer</a>. <br /></td></tr>
<tr class="separator:a02669f20097006452d877ea05e98b775"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa39f89b673da5e6f86c6b1f79ced1270"><td class="memItemLeft" align="right" valign="top"><a id="aa39f89b673da5e6f86c6b1f79ced1270"></a>
vector&lt; <a class="el" href="classcaffe_1_1Blob.html">Blob</a>&lt; Dtype &gt; * &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1SoftmaxWithLossLayer.html#aa39f89b673da5e6f86c6b1f79ced1270">softmax_bottom_vec_</a></td></tr>
<tr class="memdesc:aa39f89b673da5e6f86c6b1f79ced1270"><td class="mdescLeft">&#160;</td><td class="mdescRight">bottom vector holder used in call to the underlying <a class="el" href="classcaffe_1_1Layer.html#ab57d272dabe8c709d2a785eebe72ca57" title="Given the bottom blobs, compute the top blobs and the loss. ">SoftmaxLayer::Forward</a> <br /></td></tr>
<tr class="separator:aa39f89b673da5e6f86c6b1f79ced1270"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0fd219e185b46acce8fd74cb71dabf44"><td class="memItemLeft" align="right" valign="top"><a id="a0fd219e185b46acce8fd74cb71dabf44"></a>
vector&lt; <a class="el" href="classcaffe_1_1Blob.html">Blob</a>&lt; Dtype &gt; * &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1SoftmaxWithLossLayer.html#a0fd219e185b46acce8fd74cb71dabf44">softmax_top_vec_</a></td></tr>
<tr class="memdesc:a0fd219e185b46acce8fd74cb71dabf44"><td class="mdescLeft">&#160;</td><td class="mdescRight">top vector holder used in call to the underlying <a class="el" href="classcaffe_1_1Layer.html#ab57d272dabe8c709d2a785eebe72ca57" title="Given the bottom blobs, compute the top blobs and the loss. ">SoftmaxLayer::Forward</a> <br /></td></tr>
<tr class="separator:a0fd219e185b46acce8fd74cb71dabf44"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad77bc32fa576ad025102d29acf79aefb"><td class="memItemLeft" align="right" valign="top"><a id="ad77bc32fa576ad025102d29acf79aefb"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1SoftmaxWithLossLayer.html#ad77bc32fa576ad025102d29acf79aefb">has_ignore_label_</a></td></tr>
<tr class="memdesc:ad77bc32fa576ad025102d29acf79aefb"><td class="mdescLeft">&#160;</td><td class="mdescRight">Whether to ignore instances with a certain label. <br /></td></tr>
<tr class="separator:ad77bc32fa576ad025102d29acf79aefb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a117d31c7ac538dd7851fb493bfc75d95"><td class="memItemLeft" align="right" valign="top"><a id="a117d31c7ac538dd7851fb493bfc75d95"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1SoftmaxWithLossLayer.html#a117d31c7ac538dd7851fb493bfc75d95">ignore_label_</a></td></tr>
<tr class="memdesc:a117d31c7ac538dd7851fb493bfc75d95"><td class="mdescLeft">&#160;</td><td class="mdescRight">The label indicating that an instance should be ignored. <br /></td></tr>
<tr class="separator:a117d31c7ac538dd7851fb493bfc75d95"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4b1fa348fc885339931f132573467b81"><td class="memItemLeft" align="right" valign="top"><a id="a4b1fa348fc885339931f132573467b81"></a>
LossParameter_NormalizationMode&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1SoftmaxWithLossLayer.html#a4b1fa348fc885339931f132573467b81">normalization_</a></td></tr>
<tr class="memdesc:a4b1fa348fc885339931f132573467b81"><td class="mdescLeft">&#160;</td><td class="mdescRight">How to normalize the output loss. <br /></td></tr>
<tr class="separator:a4b1fa348fc885339931f132573467b81"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a700e28793c5b187de36b935744f5785c"><td class="memItemLeft" align="right" valign="top"><a id="a700e28793c5b187de36b935744f5785c"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><b>softmax_axis_</b></td></tr>
<tr class="separator:a700e28793c5b187de36b935744f5785c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aaabb753438f6877c7a61a52b56b19a1d"><td class="memItemLeft" align="right" valign="top"><a id="aaabb753438f6877c7a61a52b56b19a1d"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><b>outer_num_</b></td></tr>
<tr class="separator:aaabb753438f6877c7a61a52b56b19a1d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1fb0bb2aa77585f49be951062c82a9fd"><td class="memItemLeft" align="right" valign="top"><a id="a1fb0bb2aa77585f49be951062c82a9fd"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><b>inner_num_</b></td></tr>
<tr class="separator:a1fb0bb2aa77585f49be951062c82a9fd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="inherit_header pro_attribs_classcaffe_1_1Layer"><td colspan="2" onclick="javascript:toggleInherit('pro_attribs_classcaffe_1_1Layer')"><img src="closed.png" alt="-"/>&#160;Protected Attributes inherited from <a class="el" href="classcaffe_1_1Layer.html">caffe::Layer&lt; Dtype &gt;</a></td></tr>
<tr class="memitem:a7ed12bb2df25c887e41d7ea9557fc701 inherit pro_attribs_classcaffe_1_1Layer"><td class="memItemLeft" align="right" valign="top">LayerParameter&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1Layer.html#a7ed12bb2df25c887e41d7ea9557fc701">layer_param_</a></td></tr>
<tr class="separator:a7ed12bb2df25c887e41d7ea9557fc701 inherit pro_attribs_classcaffe_1_1Layer"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1d04ad7f595a82a1c811f102d68b8a19 inherit pro_attribs_classcaffe_1_1Layer"><td class="memItemLeft" align="right" valign="top">Phase&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1Layer.html#a1d04ad7f595a82a1c811f102d68b8a19">phase_</a></td></tr>
<tr class="separator:a1d04ad7f595a82a1c811f102d68b8a19 inherit pro_attribs_classcaffe_1_1Layer"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8073fcf2c139b47eb99ce71b346b1321 inherit pro_attribs_classcaffe_1_1Layer"><td class="memItemLeft" align="right" valign="top">vector&lt; shared_ptr&lt; <a class="el" href="classcaffe_1_1Blob.html">Blob</a>&lt; Dtype &gt; &gt; &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1Layer.html#a8073fcf2c139b47eb99ce71b346b1321">blobs_</a></td></tr>
<tr class="separator:a8073fcf2c139b47eb99ce71b346b1321 inherit pro_attribs_classcaffe_1_1Layer"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acd4a05def9ff3b42ad72404210613ef7 inherit pro_attribs_classcaffe_1_1Layer"><td class="memItemLeft" align="right" valign="top">vector&lt; bool &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1Layer.html#acd4a05def9ff3b42ad72404210613ef7">param_propagate_down_</a></td></tr>
<tr class="separator:acd4a05def9ff3b42ad72404210613ef7 inherit pro_attribs_classcaffe_1_1Layer"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af6d347229a139500994e7a926c680486 inherit pro_attribs_classcaffe_1_1Layer"><td class="memItemLeft" align="right" valign="top">vector&lt; Dtype &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcaffe_1_1Layer.html#af6d347229a139500994e7a926c680486">loss_</a></td></tr>
<tr class="separator:af6d347229a139500994e7a926c680486 inherit pro_attribs_classcaffe_1_1Layer"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><h3>template&lt;typename Dtype&gt;<br />
class caffe::SoftmaxWithLossLayer&lt; Dtype &gt;</h3>

<p>Computes the multinomial logistic loss for a one-of-many classification task, passing real-valued predictions through a softmax to get a probability distribution over classes. </p>
<p>This layer should be preferred over separate <a class="el" href="classcaffe_1_1SoftmaxLayer.html" title="Computes the softmax function. ">SoftmaxLayer</a> + <a class="el" href="classcaffe_1_1MultinomialLogisticLossLayer.html" title="Computes the multinomial logistic loss for a one-of-many classification task, directly taking a predi...">MultinomialLogisticLossLayer</a> as its gradient computation is more numerically stable. At test time, this layer can be replaced simply by a <a class="el" href="classcaffe_1_1SoftmaxLayer.html" title="Computes the softmax function. ">SoftmaxLayer</a>.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">bottom</td><td>input <a class="el" href="classcaffe_1_1Blob.html" title="A wrapper around SyncedMemory holders serving as the basic computational unit through which Layers...">Blob</a> vector (length 2)<ol type="1">
<li><img class="formulaInl" alt="$ (N \times C \times H \times W) $" src="form_10.png"/> the predictions <img class="formulaInl" alt="$ x $" src="form_11.png"/>, a <a class="el" href="classcaffe_1_1Blob.html" title="A wrapper around SyncedMemory holders serving as the basic computational unit through which Layers...">Blob</a> with values in <img class="formulaInl" alt="$ [-\infty, +\infty] $" src="form_17.png"/> indicating the predicted score for each of the <img class="formulaInl" alt="$ K = CHW $" src="form_18.png"/> classes. This layer maps these scores to a probability distribution over classes using the softmax function <img class="formulaInl" alt="$ \hat{p}_{nk} = \exp(x_{nk}) / \left[\sum_{k'} \exp(x_{nk'})\right] $" src="form_171.png"/> (see <a class="el" href="classcaffe_1_1SoftmaxLayer.html" title="Computes the softmax function. ">SoftmaxLayer</a>).</li>
<li><img class="formulaInl" alt="$ (N \times 1 \times 1 \times 1) $" src="form_22.png"/> the labels <img class="formulaInl" alt="$ l $" src="form_23.png"/>, an integer-valued <a class="el" href="classcaffe_1_1Blob.html" title="A wrapper around SyncedMemory holders serving as the basic computational unit through which Layers...">Blob</a> with values <img class="formulaInl" alt="$ l_n \in [0, 1, 2, ..., K - 1] $" src="form_24.png"/> indicating the correct class label among the <img class="formulaInl" alt="$ K $" src="form_25.png"/> classes </li>
</ol>
</td></tr>
    <tr><td class="paramname">top</td><td>output <a class="el" href="classcaffe_1_1Blob.html" title="A wrapper around SyncedMemory holders serving as the basic computational unit through which Layers...">Blob</a> vector (length 1)<ol type="1">
<li><img class="formulaInl" alt="$ (1 \times 1 \times 1 \times 1) $" src="form_26.png"/> the computed cross-entropy classification loss: <img class="formulaInl" alt="$ E = \frac{-1}{N} \sum\limits_{n=1}^N \log(\hat{p}_{n,l_n}) $" src="form_126.png"/>, for softmax output class probabilites <img class="formulaInl" alt="$ \hat{p} $" src="form_101.png"/> </li>
</ol>
</td></tr>
  </table>
  </dd>
</dl>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="ac3a01d6846a9b62c1790635d53185e81"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac3a01d6846a9b62c1790635d53185e81">&#9670;&nbsp;</a></span>SoftmaxWithLossLayer()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename Dtype &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classcaffe_1_1SoftmaxWithLossLayer.html">caffe::SoftmaxWithLossLayer</a>&lt; Dtype &gt;::<a class="el" href="classcaffe_1_1SoftmaxWithLossLayer.html">SoftmaxWithLossLayer</a> </td>
          <td>(</td>
          <td class="paramtype">const LayerParameter &amp;&#160;</td>
          <td class="paramname"><em>param</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">explicit</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">param</td><td>provides LossParameter loss_param, with options:<ul>
<li>ignore_label (optional) Specify a label value that should be ignored when computing the loss.</li>
<li>normalize (optional, default true) If true, the loss is normalized by the number of (nonignored) labels present; otherwise the loss is simply summed over spatial locations. </li>
</ul>
</td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a39d8b7d59f2c951ac2573827f181284f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a39d8b7d59f2c951ac2573827f181284f">&#9670;&nbsp;</a></span>Backward_cpu()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename Dtype &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classcaffe_1_1SoftmaxWithLossLayer.html">caffe::SoftmaxWithLossLayer</a>&lt; Dtype &gt;::Backward_cpu </td>
          <td>(</td>
          <td class="paramtype">const vector&lt; <a class="el" href="classcaffe_1_1Blob.html">Blob</a>&lt; Dtype &gt; *&gt; &amp;&#160;</td>
          <td class="paramname"><em>top</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const vector&lt; bool &gt; &amp;&#160;</td>
          <td class="paramname"><em>propagate_down</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const vector&lt; <a class="el" href="classcaffe_1_1Blob.html">Blob</a>&lt; Dtype &gt; *&gt; &amp;&#160;</td>
          <td class="paramname"><em>bottom</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Computes the softmax loss error gradient w.r.t. the predictions. </p>
<p>Gradients cannot be computed with respect to the label inputs (bottom[1]), so this method ignores bottom[1] and requires !propagate_down[1], crashing if propagate_down[1] is set.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">top</td><td>output <a class="el" href="classcaffe_1_1Blob.html" title="A wrapper around SyncedMemory holders serving as the basic computational unit through which Layers...">Blob</a> vector (length 1), providing the error gradient with respect to the outputs<ol type="1">
<li><img class="formulaInl" alt="$ (1 \times 1 \times 1 \times 1) $" src="form_26.png"/> This <a class="el" href="classcaffe_1_1Blob.html" title="A wrapper around SyncedMemory holders serving as the basic computational unit through which Layers...">Blob</a>'s diff will simply contain the loss_weight* <img class="formulaInl" alt="$ \lambda $" src="form_57.png"/>, as <img class="formulaInl" alt="$ \lambda $" src="form_57.png"/> is the coefficient of this layer's output <img class="formulaInl" alt="$\ell_i$" src="form_58.png"/> in the overall <a class="el" href="classcaffe_1_1Net.html" title="Connects Layers together into a directed acyclic graph (DAG) specified by a NetParameter. ">Net</a> loss <img class="formulaInl" alt="$ E = \lambda_i \ell_i + \mbox{other loss terms}$" src="form_59.png"/>; hence <img class="formulaInl" alt="$ \frac{\partial E}{\partial \ell_i} = \lambda_i $" src="form_60.png"/>. (*Assuming that this top <a class="el" href="classcaffe_1_1Blob.html" title="A wrapper around SyncedMemory holders serving as the basic computational unit through which Layers...">Blob</a> is not used as a bottom (input) by any other layer of the <a class="el" href="classcaffe_1_1Net.html" title="Connects Layers together into a directed acyclic graph (DAG) specified by a NetParameter. ">Net</a>.) </li>
</ol>
</td></tr>
    <tr><td class="paramname">propagate_down</td><td>see <a class="el" href="classcaffe_1_1Layer.html#a183d343f5183a4762307f2c5e6ed1e12" title="Given the top blob error gradients, compute the bottom blob error gradients. ">Layer::Backward</a>. propagate_down[1] must be false as we can't compute gradients with respect to the labels. </td></tr>
    <tr><td class="paramname">bottom</td><td>input <a class="el" href="classcaffe_1_1Blob.html" title="A wrapper around SyncedMemory holders serving as the basic computational unit through which Layers...">Blob</a> vector (length 2)<ol type="1">
<li><img class="formulaInl" alt="$ (N \times C \times H \times W) $" src="form_10.png"/> the predictions <img class="formulaInl" alt="$ x $" src="form_11.png"/>; Backward computes diff <img class="formulaInl" alt="$ \frac{\partial E}{\partial x} $" src="form_45.png"/></li>
<li><img class="formulaInl" alt="$ (N \times 1 \times 1 \times 1) $" src="form_22.png"/> the labels &ndash; ignored as we can't compute their error gradients </li>
</ol>
</td></tr>
  </table>
  </dd>
</dl>

<p>Implements <a class="el" href="classcaffe_1_1Layer.html#a75c9b2a321dc713e0eaef530d02dc37f">caffe::Layer&lt; Dtype &gt;</a>.</p>

</div>
</div>
<a id="a9035d000b2ce51a973f255a5eb2df8e3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9035d000b2ce51a973f255a5eb2df8e3">&#9670;&nbsp;</a></span>ExactNumTopBlobs()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename Dtype &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual int <a class="el" href="classcaffe_1_1SoftmaxWithLossLayer.html">caffe::SoftmaxWithLossLayer</a>&lt; Dtype &gt;::ExactNumTopBlobs </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Returns the exact number of top blobs required by the layer, or -1 if no exact number is required. </p>
<p>This method should be overridden to return a non-negative value if your layer expects some exact number of top blobs. </p>

<p>Reimplemented from <a class="el" href="classcaffe_1_1LossLayer.html#aa5d5ab714a14082f5343dc9c49025b23">caffe::LossLayer&lt; Dtype &gt;</a>.</p>

</div>
</div>
<a id="aef4567bafcd7b1665f2a2cc71ea02ff4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aef4567bafcd7b1665f2a2cc71ea02ff4">&#9670;&nbsp;</a></span>get_normalizer()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename Dtype &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">Dtype <a class="el" href="classcaffe_1_1SoftmaxWithLossLayer.html">caffe::SoftmaxWithLossLayer</a>&lt; Dtype &gt;::get_normalizer </td>
          <td>(</td>
          <td class="paramtype">LossParameter_NormalizationMode&#160;</td>
          <td class="paramname"><em>normalization_mode</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>valid_count</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Read the normalization mode parameter and compute the normalizer based on the blob size. If normalization_mode is VALID, the count of valid outputs will be read from valid_count, unless it is -1 in which case all outputs are assumed to be valid. </p>

</div>
</div>
<a id="a96cd04896d4b805fcaf36c2c6522ae10"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a96cd04896d4b805fcaf36c2c6522ae10">&#9670;&nbsp;</a></span>LayerSetUp()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename Dtype &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classcaffe_1_1SoftmaxWithLossLayer.html">caffe::SoftmaxWithLossLayer</a>&lt; Dtype &gt;::LayerSetUp </td>
          <td>(</td>
          <td class="paramtype">const vector&lt; <a class="el" href="classcaffe_1_1Blob.html">Blob</a>&lt; Dtype &gt; *&gt; &amp;&#160;</td>
          <td class="paramname"><em>bottom</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const vector&lt; <a class="el" href="classcaffe_1_1Blob.html">Blob</a>&lt; Dtype &gt; *&gt; &amp;&#160;</td>
          <td class="paramname"><em>top</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Does layer-specific setup: your layer should implement this function as well as Reshape. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">bottom</td><td>the preshaped input blobs, whose data fields store the input data for this layer </td></tr>
    <tr><td class="paramname">top</td><td>the allocated but unshaped output blobs</td></tr>
  </table>
  </dd>
</dl>
<p>This method should do one-time layer specific setup. This includes reading and processing relevent parameters from the <code>layer_param_</code>. Setting up the shapes of top blobs and internal buffers should be done in <code>Reshape</code>, which will be called before the forward pass to adjust the top blob sizes. </p>

<p>Reimplemented from <a class="el" href="classcaffe_1_1LossLayer.html#aa6fc7c2e90be66f1c1f0683637c949da">caffe::LossLayer&lt; Dtype &gt;</a>.</p>

</div>
</div>
<a id="a5a0b4c02fe76ae9087cd8b1b9edd9910"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5a0b4c02fe76ae9087cd8b1b9edd9910">&#9670;&nbsp;</a></span>MaxTopBlobs()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename Dtype &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual int <a class="el" href="classcaffe_1_1SoftmaxWithLossLayer.html">caffe::SoftmaxWithLossLayer</a>&lt; Dtype &gt;::MaxTopBlobs </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Returns the maximum number of top blobs required by the layer, or -1 if no maximum number is required. </p>
<p>This method should be overridden to return a non-negative value if your layer expects some maximum number of top blobs. </p>

<p>Reimplemented from <a class="el" href="classcaffe_1_1Layer.html#ac6c03df0b6e40e776c94001e19994a2e">caffe::Layer&lt; Dtype &gt;</a>.</p>

</div>
</div>
<a id="a9969336702fb1bbf31750629fb38fb45"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9969336702fb1bbf31750629fb38fb45">&#9670;&nbsp;</a></span>MinTopBlobs()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename Dtype &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual int <a class="el" href="classcaffe_1_1SoftmaxWithLossLayer.html">caffe::SoftmaxWithLossLayer</a>&lt; Dtype &gt;::MinTopBlobs </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Returns the minimum number of top blobs required by the layer, or -1 if no minimum number is required. </p>
<p>This method should be overridden to return a non-negative value if your layer expects some minimum number of top blobs. </p>

<p>Reimplemented from <a class="el" href="classcaffe_1_1Layer.html#ab9e4c8d642e413948b131d851a8462a4">caffe::Layer&lt; Dtype &gt;</a>.</p>

</div>
</div>
<a id="a2821b89b0f46a5e2ddaccb2708ab237b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2821b89b0f46a5e2ddaccb2708ab237b">&#9670;&nbsp;</a></span>Reshape()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename Dtype &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classcaffe_1_1SoftmaxWithLossLayer.html">caffe::SoftmaxWithLossLayer</a>&lt; Dtype &gt;::Reshape </td>
          <td>(</td>
          <td class="paramtype">const vector&lt; <a class="el" href="classcaffe_1_1Blob.html">Blob</a>&lt; Dtype &gt; *&gt; &amp;&#160;</td>
          <td class="paramname"><em>bottom</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const vector&lt; <a class="el" href="classcaffe_1_1Blob.html">Blob</a>&lt; Dtype &gt; *&gt; &amp;&#160;</td>
          <td class="paramname"><em>top</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Adjust the shapes of top blobs and internal buffers to accommodate the shapes of the bottom blobs. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">bottom</td><td>the input blobs, with the requested input shapes </td></tr>
    <tr><td class="paramname">top</td><td>the top blobs, which should be reshaped as needed</td></tr>
  </table>
  </dd>
</dl>
<p>This method should reshape top blobs as needed according to the shapes of the bottom (input) blobs, as well as reshaping any internal buffers and making any other necessary adjustments so that the layer can accommodate the bottom blobs. </p>

<p>Reimplemented from <a class="el" href="classcaffe_1_1LossLayer.html#abf00412194f5413ea9468ee44b0d986f">caffe::LossLayer&lt; Dtype &gt;</a>.</p>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>include/caffe/layers/<a class="el" href="softmax__loss__layer_8hpp_source.html">softmax_loss_layer.hpp</a></li>
<li>src/caffe/layers/softmax_loss_layer.cpp</li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Thu Aug 3 2017 23:11:30 for Caffe by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>
